package SingletonDemo.exp1;

/**
 * @author zsh
 * @Description 5-1
 * @create 2022-05-13 19:37
 */
public class TicketMaker {
    private static TicketMaker ticketMaker = new TicketMaker();
    private int ticket = 1000;

    private TicketMaker(){
        System.out.println("生成一个实例");
    }
    public synchronized int getNextTicketNum(){
        return ticket++;
    }
    public static TicketMaker getTicketMaker(){
        return ticketMaker;
    }
}
